package com.alu4r.atcrowdfunding.potal.service.impl;

import com.alu4r.atcrowdfunding.bean.Member;
import com.alu4r.atcrowdfunding.exception.LoginFailException;


import com.alu4r.atcrowdfunding.potal.dao.MemberMapper;
import com.alu4r.atcrowdfunding.potal.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class MemberServiceImpl implements MemberService {
    @Autowired
    private MemberMapper memberMapper;

    @Override
    public Member queryMemberLogin(Map<String, Object> maps) {
        Member member = memberMapper.queryMemberLogin(maps);
        if(member == null){
            throw new LoginFailException("用户名或者密码错误");
        }
        return member;
    }

    @Override
    public int updateAcctType(Member member) {
        return memberMapper.updateAcctType(member);
    }

    @Override
    public int updateEmail(Member loginMember) {
        return memberMapper.updateEmail(loginMember);
    }

    @Override
    public void updateAuthstatus(Member loginMember) {
        memberMapper.updateAuthstatus(loginMember);
    }

    @Override
    public Member getMemberById(Integer memberid) {
        return memberMapper.getMemberById(memberid);
    }

    @Override
    public List<Map<String, Object>> queryCertByMemberid(Integer memberid) {
        return memberMapper.queryCertByMemberid(memberid);
    }

    @Override
    public int updateBasicInfo(Member loginMember) {
        return memberMapper.updateBasicInfo(loginMember);
    }

}
